﻿<UserControl x:Class="Patterns4Net.ArchitectureExplorer.Views.DiagramBrowserView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Diagram="clr-namespace:Patterns4Net.ArchitectureExplorer.Diagram" 
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <HierarchicalDataTemplate DataType="{x:Type Diagram:Layer}" ItemsSource="{Binding Path=Packages}">
            <StackPanel Orientation="Horizontal" Margin="0, 0, 0, 5">
                <Image Source=".\..\Image\Layer.png" Width="16" Height="16" Margin="0, 0, 7, 0"/>
                <TextBlock Text="{Binding Path=Name}"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate DataType="{x:Type Diagram:Package}" ItemsSource="{Binding Path=Types}">
            <StackPanel Orientation="Horizontal" Margin="0, 0, 0, 2">
                <Image Source=".\..\Image\Package.png" Width="16" Height="16" Margin="0, 0, 7, 0"/>
                <TextBlock Text="{Binding Path=Name}"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate DataType="{x:Type Diagram:TypeInfo}">
            <StackPanel Orientation="Horizontal" Margin="0, 0, 0, 0">
                <Image Source=".\..\Image\Class.png" Width="16" Height="16" Margin="0, 0, 7, 0"/>
                <TextBlock Text="{Binding Path=Name}"/>
            </StackPanel>
        </HierarchicalDataTemplate>
    </UserControl.Resources>

    <StackPanel Background="White">
        <TreeView x:Name="Layers" Margin="10, 15, 0, 0" BorderThickness="0"
            cal:Action.Target="{Binding}"
            cal:Message.Attach="[Event MouseDoubleClick] = [Action ItemDoubleClick($this.SelectedItem)];
                  [Event SelectedItemChanged] = [Action SelectedItemChanged($this.SelectedItem)]">
        </TreeView>
    </StackPanel>
</UserControl>
